<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>显示</title>
    <script></script>
</head>
<body>
    <table border="1">
        <thead>
            <tr>
                <th>角色ID</th>
                <th>角色名称</th>
                <th colspan="2">操作</th>
            </tr>
        </thead>
        <tbody>
            <tr th:each="userType: ${userTypes}">
                <td th:text="${userType.typeId}"></td>
                <td th:text="${userType.typeName}"></td>
                <td>
                    <a th:href="@{/userType/}+${userType.typeId}">编辑</a>
                </td>
                <td>
                    <button th:attr="del_uri=@{/userType/}+${userType.typeId}" class="delBtn">删除</button>
<!--                    <button th:attr="del_uri=@{/emp/}+${emp.id}" class="delBtn">删除</button>-->
                </td>
            </tr>
        </tbody>
    </table>
    <form id="deleteUserTypeForm"  method="post">
        <input type="hidden" name="_method" value="delete"/>
    </form>
    <script src="assets/js/jquery.min.js" th:src="@{/assets/js/jquery.min.js}"></script>
    <script>
        $(".delBtn").click(function(){
            //删除当前角色的
            $("#deleteUserTypeForm").attr("action",$(this).attr("del_uri")).submit();
            return false;
        });
    </script>
</body>
</html>